package com.netease.neliveplayer.playerkit.videoLoader;

import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

import androidx.annotation.CallSuper;

abstract public class OnVideoListTouchEventHandler implements View.OnTouchListener {

    private long lastClickTime = 0;
    private long clickInternal = 500;
    private String tag = "OnTouchEventHandler";
    @CallSuper
    public boolean onTouch(View v, MotionEvent event, int position) {
        if (System.currentTimeMillis() - lastClickTime <= clickInternal)
            return true;
        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                Log.d(tag, "click down:" + position);
                break;
            case MotionEvent.ACTION_UP:
                Log.d(tag, "click up ");
                lastClickTime = System.currentTimeMillis();
                break;
            case MotionEvent.ACTION_CANCEL:
                Log.d(tag, "click cancel");
                // 处理取消事件
                break;
            // 其他事件类型的处理
        }
        return false;
    }
}
